<?php
/**
 * 2020/10/12
 * Created by breeze
 * User: breeze
 */

namespace app\common\lib;


class ClassAttr
{
    public static function smsClassStat(){
        return [
            "ali" => "app\common\lib\sms\AliSms",
            "baidu" => "app\common\lib\sms\BaiduSms",
            "jd" => "app\common\lib\sms\JdSms",
        ];
    }

    public static function initClass ($type,$classes,$params=[],$needInstance = false){
        if(!array_key_exists($type,$classes)){
            return false;
        }
        $className = $classes[$type];
        if($needInstance == true){
            $class = new \ReflectionClass($className);
            $instance = $class->newInstanceArgs();
            return $instance;
        }else{
            return $className;
        }
//        $needInstance == true?(new \ReflectionClass($className))->newInstanceArgs():$className;

    }
}